package com.gitee.fsmxm.ocon.core;

import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author fsmxm
 */
public class DCThreadFactory implements ThreadFactory {

    private String prefix;

    private AtomicInteger count;

    public DCThreadFactory(String prefix) {
        this.prefix = prefix;
        this.count = new AtomicInteger();
    }

    @Override
    public Thread newThread(Runnable r) {
        return new Thread(r, prefix + count.incrementAndGet());
    }
}
